package com.ynny.student.lifecycle;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; // 导入正确的上下文类

public class LifecycleTest {
    public static void main(String[] args) {
        ApplicationContext context;
        context = new ClassPathXmlApplicationContext("lifecycle.xml"); // 使用正确的上下文类
        Lifecycle lifecycle = (Lifecycle) context.getBean("lifecycle");
        lifecycle.print();
        ((ClassPathXmlApplicationContext)context).close(); // 关闭上下文
    }
}
